package com.util;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;

/**
 * Created by webrx on 2017/6/23.
 */
public class DbHeper {
    public SqlSession ss;
    public SqlSessionFactory sf;

    public DbHeper() {
        try {
            this.sf = new SqlSessionFactoryBuilder().build(Resources.getResourceAsStream("mybatis01-confing.xml"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        this.ss = this.sf.openSession();
    }
    public SqlSession getSession(){
        return this.ss;
    }
}
